package com.jccfc.domain.email;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

/**
 * @Auther: qym
 * @Date: 2021/1/11 11:16
 * @Description: 用户名密码验证，需要实现抽象类Authenticator的抽象方法PasswordAuthentication，
 *  *                SMTP验证类(内部类)，继承javax.mail.Authenticator
 */
public class MyAuthenricator extends Authenticator {

    //用户名
    String username = null;
    //密码
    String password = null;

    public MyAuthenricator(String username, String password) {
        this.username = username;
        this.password = password;
    }

    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(username, password);
    }

}
